package com.xggstudio.crm.api;

import com.xggstudio.crm.ui.mvp.m.AssistList;
import com.xggstudio.crm.ui.mvp.m.BaseResult;
import com.xggstudio.crm.ui.mvp.m.CusInfo;
import com.xggstudio.crm.ui.mvp.m.CusListBean;
import com.xggstudio.crm.ui.mvp.m.LoginBean;
import com.xggstudio.crm.ui.mvp.m.ReturnVisitBean;
import com.xggstudio.crm.ui.mvp.m.UserInfoBean;

import java.util.ArrayList;
import java.util.Map;

import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;

public interface Server {

    public String BASE_URL = "http://crm.eduxgg.com/api/";

    @FormUrlEncoded
    @POST("login")
    Observable<LoginBean> login(@Field("email") String email, @Field("password") String password);

    @GET("info")
    Observable<UserInfoBean> getInfo(@Query("token") String token);

    @GET("client")
    Observable<CusListBean> getCuaListData(@Query("token") String token,@Query("offset") int offset,@Query("limit") int limit);

    @FormUrlEncoded
    @POST("client")
    Observable<BaseResult> addcusData(@Field("client_name") String client_name
                    ,@Field("client_documentary") String client_documentary
                    ,@Field("client_phone") String client_phone
                    ,@Field("client_qq") String client_qq
                    ,@Field("client_wechat") String client_wechat
                    ,@Field("client_email") String client_email
                    ,@Field("client_sex") String client_sex
                    ,@Field("client_online") String client_online
                    ,@Field("client_birthday") String client_birthday
                    ,@Field("client_age") String client_age
                    ,@Field("client_company") String client_company
                    ,@Field("client_province") String client_province
                    ,@Field("client_city") String client_city
                    ,@Field("client_county") String client_county
                    ,@Field("client_address") String client_address
                    ,@Field("class_id") String class_id
                    ,@Field("client_follows") String client_follows
                    ,@Field("assist[]") String[] assist[]
                    ,@Field("percent[]") String[] percent[]);

    @FormUrlEncoded
    @POST("client")
    Observable<BaseResult> addcusData(@Query("token") String token, @FieldMap Map<String, String> fields);

    @FormUrlEncoded
    @PUT("client")
    Observable<BaseResult> editcusData(@FieldMap Map<String, String> fields);

    @GET("returnVisit")
    Observable<ReturnVisitBean> getReturnVisitListData(@Query("token") String token, @Query("offset") int offset, @Query("limit") int limit);

    @GET("client/{id}")
    Observable<CusInfo> getCusInfo(@Path("id") int id , @Query("token") String token);

    @GET("client/assist_list")
    Observable<AssistList> getAssistList(@Query("token") String token);

}
